package com.diy.sigmund.diycommon.test.controller.excel.easyexcel.register;

import com.alibaba.excel.write.handler.SheetWriteHandler;
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder;
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * @author ylm-sigmund
 * @since 2021/9/18 15:32
 */
public class CustomSheetWriteHandler implements SheetWriteHandler {

    private static final Logger log = LoggerFactory.getLogger(CustomSheetWriteHandler.class);

    /** 修改sheet名称得在sheet创建前完成 */
    @Override
    public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
        log.info("beforeSheetCreate");
        writeSheetHolder.setSheetName("运行时修改的sheet名称");
    }

    @Override
    public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) {
    }
}
